<template>
	<!-- 商铺管理 -->
	<view class="s_wp">
		<view class="list" v-if="list.length>0">
			<view class="item" v-for="(item,index) in list" :key="item.id" @click="$navTo('/pages/groupmenu/groupShopList?id='+item.id)">
				<view class="info">
					<view class="tit clamp">{{item.name}}</view>
					<view class="type">店铺数量：{{item.num}}</view>
					<view class="name">创建时间：{{item.createtime}}</view>
				</view>
				<view class="btn" @click.stop="dissolution(item.id,index)">解散</view>
			</view>
		</view>
		<view class="empty_loading">
			<image v-show="isloading" src="/static/business/loading.gif" mode=""></image>
			<text v-show="!ismore">到底了~</text>
		</view>
		<view class="bottom">
			<view class="s_add" @click="$navTo('/pages/groupmenu/addGroup')">创建集团</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				isloading: false,
				ismore: false,
				page: 0,
			};
		},
		onLoad() {
			this.getlist();
		},
		onReachBottom(){
			this.getlist();
		},
		methods: {
			getlist() {
				this.page++;
				this.isloading = true;
				this.$axios('groupsupp/lists', 'POST', 'member').then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						this.list = res.data.data.list;
						this.ismore = res.data.data.list.length > 0;
					}
				})
			},
			dissolution(id,index){
				this.$axios('groupsupp/delGroup', 'POST', 'member',{
					id
				}).then(res => {
					if (res.data.code == 200) {
						this.$api.msg(res.data.data);
						this.list.splice(index,1);
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	background: #FBF8FE;
	padding-bottom: 170rpx;
}
.s_wp {
		overflow: hidden;
		padding: 20rpx;
	}
	.list{
		.item{
			background: #FFFFFF;
			border-radius: 12rpx;
			padding: 20rpx;
			margin-bottom: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
				image{
					width: 144rpx;
					height: 144rpx;
					border-radius: 12rpx;
				}
				.info{
					// width: calc(100% - 254rpx);
					width: 100%;
					// padding-left: 20rpx;
					font-size: 24rpx;
					line-height: 1.8;
					.tit{
						font-size: 28rpx;
						color: #333333;
						font-weight: 600;
					}
					.type{
						color: #8615E1;
					}
					.name{
						color: #999999;
					}
				}
				.btn{
					width: 110rpx;
					height: 60rpx;
					background: #FBF8FE;
					border-radius: 30rpx;
					line-height: 60rpx;
					text-align: center;
				}
		}
	}
	.bottom{
		width: 100%;
		height: 148rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 4rpx 22rpx 0rpx #F3E8FC;
		position: fixed;
		bottom: 0;
		.s_add {
			width: 396rpx;
			height: 74rpx;
			background: linear-gradient( 270deg, #8917E2 0%, #B92DF1 100%);
			border-radius: 38rpx;
			font-size: 28rpx;
			color: #FFFFFF;
			line-height: 74rpx;
			text-align: center;
			margin: 30rpx auto;
		}
	}
</style>
